<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <ul class="nav">
            <li><a href="#">选项1</a></li>
            <li><a href="#">选项2</a></li>
            <li><a href="#">选项3</a></li>
        </ul>

        <style>
            .nav {
                list-style: none;
                display: flex;
                justify-content: center;
            }

            .nav li {
                margin: 0 10px;
            }

            .nav a {
                position: relative;
                display: inline-block;
                padding-bottom: 5px;
                text-decoration: none;
                color: #000;
            }

            .nav a:after {
                content: "";
                position: absolute;
                bottom: 0;
                left: 50%;
                width: 0;
                height: 2px;
                background-color: #f00;
                transition: border 0.3s ease;
            }

            .nav a:hover:after {
                width: 100%;
                left: 0;
            }
        </style>
    </body>
</html>
